package pro.spring.controller.backController;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
@RequestMapping("theme")
public class FThemController extends BaseController{
	
	private String local = "page/back/them/";
	
	private String defaultpath="redirect:list.html";
	
	private Integer pagesize = 10 ;
	
	@RequestMapping(value="list.html",method=RequestMethod.GET)
	public String discussList(@RequestParam(value = "p", defaultValue = "1")Integer pagenum,ModelMap map,String key){
		map.put("page", themeService.getPaginationInfo(key,pagenum, pagesize));
		map.put("key",key);
		return local+"themli";
	}
	
	@RequestMapping(value="{id}.html",method=RequestMethod.GET)
	public String discussList(@PathVariable int id){
		themeService.deleteByPrimaryKey(id);
		return defaultpath;
	}
}
